home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / xcmd / dxcmds34.sit / Dartmouth XCMD's 3.4.3 / card_6278.txt < prev    next >
Text File  |  1990-04-17  |  6KB  |  196 lines

  1. -- card: 6278 from stack: in.3
  2. -- bmap block id: 7520
  3. -- flags: 4000
  4. -- background id: 8327
  5. -- name: XScrollBoxF
  6. ----- HyperTalk script -----
  7. on Install
  8.   get ChooseTargetStack()
  9.   InstallResource XFCN,XScrollBoxF,it
  10.   InstallResource DITL,XScrollBoxF,it
  11.   InstallResource DLOG,XScrollBoxF,it
  12. end Install
  13.  
  14.  
  15. -- part 2 (field)
  16. -- low flags: 01
  17. -- high flags: 4007
  18. -- rect: left=389 top=163 right=286 bottom=489
  19. -- title width / last selected line: 0
  20. -- icon id / first selected line: 0 / 0
  21. -- text alignment: 0
  22. -- font id: 3
  23. -- text size: 9
  24. -- style flags: 0
  25. -- line height: 12
  26. -- part name: scroller
  27.  
  28.  
  29. -- part 5 (field)
  30. -- low flags: 01
  31. -- high flags: 2007
  32. -- rect: left=18 top=32 right=286 bottom=384
  33. -- title width / last selected line: 0
  34. -- icon id / first selected line: 0 / 0
  35. -- text alignment: 0
  36. -- font id: 3
  37. -- text size: 10
  38. -- style flags: 0
  39. -- line height: 13
  40. -- part name: Documentation
  41.  
  42.  
  43. -- part 8 (field)
  44. -- low flags: 01
  45. -- high flags: 0002
  46. -- rect: left=388 top=49 right=141 bottom=488
  47. -- title width / last selected line: 0
  48. -- icon id / first selected line: 0 / 0
  49. -- text alignment: 0
  50. -- font id: 3
  51. -- text size: 9
  52. -- style flags: 0
  53. -- line height: 12
  54. -- part name: fonts
  55.  
  56.  
  57. -- part 9 (button)
  58. -- low flags: 00
  59. -- high flags: 8003
  60. -- rect: left=76 top=298 right=320 bottom=176
  61. -- title width / last selected line: 0
  62. -- icon id / first selected line: 0 / 0
  63. -- text alignment: 1
  64. -- font id: 0
  65. -- text size: 12
  66. -- style flags: 0
  67. -- line height: 16
  68. -- part name: XScrollBoxF
  69. ----- HyperTalk script -----
  70. on mouseUp
  71.   put XScrollBox(4,"Choose Font for Stuff List:",card field "fonts", "Help") into f
  72.   if f is "Help" then
  73.     doHelp
  74.     exit mouseUp
  75.   else if f is empty or f is "cancel" then exit mouseUp
  76.   else
  77.     put item 2 of f into f
  78.     get XScrollBoxF("c","Choose some stuff:",card field "scroller","",f)
  79.     if it is empty then exit mouseUp
  80.     go this card
  81.     answer "Selection was:"&&it
  82.   end if
  83. end mouseUp
  84.  
  85. on doHelp
  86.   put "Choose a font to use in displaying the test field."
  87. end doHelp
  88.  
  89.  
  90. -- part contents for card part 5
  91. ----- text -----
  92. XScrollBoxF version 2.4
  93. Roger Brown
  94.  
  95. XScrollBoxF is a version of XScrollBox that allows the selection list to be presented in a font other than the system font.
  96. For example, this is being used to create an index to Greek literary references using a Greek font. All specifications are the same as for XScrollBox except for an additional input parameter: the name of the font to use. The named font must be available from the system or the stack and the font size will always be 12.
  97.  
  98. The return value has two items: the number of the selection and the text of the selection. These are separated by commas as in normal HyperCard format. 
  99.    
  100. Selection can be made by :
  101.    1. double-clicking on a line.
  102.    2. single-clicking on a line, then pressing the OK button.
  103.    3. single-clicking on a line, then pressing the Return key.
  104.    4. typing the first letter(s) of a selection, then doing 1,2, or 3.
  105.      (Note: type selection assumes that the lines are ordered
  106.         alphabetically)
  107.    5. scrolling with up and down arrow keys, then doing 1,2 or 3.
  108.    
  109.    If the Cancel button is pressed, the string "Cancel" is returned.
  110.      
  111.    It requires that the DITL and DLOG resources (1346) packaged 
  112.    with it are in the stack.
  113.    
  114.   The dialog is centered on the screen and sized to hold the width of the longest line and/or the prompt line, whichever is widest. It will not overrun the width of a  Mac+ screen.
  115.  
  116. INVOKING XScrollBoxF
  117.  
  118.   get XScrollBoxF(first,prompt,container,userButton,font)
  119.         
  120.    where   first  is a default selection in the list - either a number or 
  121.                           a text string (0 if none).
  122.                 prompt is a string to prompt the user. This appears at the 
  123.                           top of the dialog box.
  124.                 container is any hypercard container (field, variable), 
  125.                          presumed to be multi-lined.
  126.                 UserButton  is the name for an optional author specified 
  127.                          button. If this button is pressed, its name is returned             
  128.                          further processing by the script.  
  129.                  Font is the name of the font to use.
  130.  
  131. EXAMPLE
  132.  
  133.  ex.  get XScrollBoxF(1,"Choose:",card field 1,"Help","cartoon")
  134.         if OK is pressed, returns : 1,text of line 1 of card field 1
  135.  
  136.  
  137. REVISION HISTORY
  138. 1.1 center dialog box on any size screen
  139. 1.2 - add selection scrolling by typing and by cursor keys
  140. 1.3 - add text of chosen item to return value
  141. 1.4 - 3/2/88   add optional user button
  142. 1.6 - fixed some selection by typing problems
  143. 1.7 - LSC 3.0 compatible.  Fixed problem of a bomb if the font is
  144.           not specified.
  145. 2.0 - 9/9/89 SuperCard compatible, fixed bugs in typing-selection,
  146.          and userButton string handling.  First item is selected if there     
  147.          is no default and the user presses a cursor arrow key. One 
  148.          source for all 3 versions, control version with compiler 
  149.          variables. Compiles under THINK C Γäó 4.0.
  150. 2.1 - 2/21/90 Puch of cancel button now returns "Cancel" string.
  151.          Fixed some bugs in allocatin and use of return handle.
  152. 2.2 - 3/29/90 Correctly displays eight-bit characters.
  153. 2.3 - 3/30/90 added XScrollBoxML variation
  154. 2.4 - 4/17/90 revived a feature that had disappeared: specifying    
  155.           the default selection in XScrollBox and XScrollBox F as a 
  156.           string rather than a number
  157.  
  158.  
  159.  
  160. -- part contents for card part 8
  161. ----- text -----
  162. Chicago
  163. Courier
  164. Geneva
  165. Helvetica
  166. Monaco
  167. New York
  168. Doesn't Exist
  169.  
  170. -- part contents for card part 2
  171. ----- text -----
  172. able
  173. baker
  174. charlie
  175. dog
  176. ernest
  177. fox
  178. gamma
  179. horse
  180. ice cream
  181. jumping jack flash
  182. knockwurst
  183. liver
  184. monkey
  185. no way, jose
  186. occularity
  187. penelope
  188. qwerty
  189. rapscallion
  190. salubrious
  191. twinkle toes
  192. underwhelmed
  193. vermin
  194. wascally wabbit
  195. yokel
  196. zenzational